/**
 * 文档示例样式
 * 用于统一示例预览的显示效果
 */

/* 示例预览容器 */
.example-preview {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #fff;
}

.example-preview iframe {
  display: block;
  width: 100%;
  border: none;
  background: white;
}

/* 响应式示例容器 */
.example-preview-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 75%; /* 4:3 比例 */
  height: 0;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.example-preview-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* 代码示例容器 */
.code-example {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  overflow-x: auto;
}

.code-example code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

/* 示例标签页 */
.example-tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 0 0;
  border-bottom: 1px solid #e0e0e0;
}

.example-tab {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  color: #666;
  transition: all 0.3s ease;
}

.example-tab:hover {
  color: var(--color-brand, #0A59F7);
}

.example-tab.active {
  color: var(--color-brand, #0A59F7);
  border-bottom-color: var(--color-brand, #0A59F7);
}

.example-content {
  display: none;
}

.example-content.active {
  display: block;
}

/* 示例加载状态 */
.example-preview.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  background: #f5f5f5;
}

.example-preview.loading::before {
  content: '加载中...';
  color: #999;
  font-size: 14px;
}

/* 示例链接样式 */
.example-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--color-brand, #0A59F7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.example-link:hover {
  color: var(--color-brand-hover, #0047cc);
  text-decoration: underline;
}

.example-link::after {
  content: ' ↗';
  font-size: 12px;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
  .example-preview {
    border-color: #444;
    background: #1a1a1a;
  }
  
  .code-example {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
  }
  
  .example-tabs {
    border-bottom-color: #444;
  }
  
  .example-tab {
    color: #999;
  }
  
  .example-preview.loading {
    background: #2a2a2a;
  }
  
  .example-preview.loading::before {
    color: #666;
  }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .example-preview {
    margin: 16px -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .example-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .example-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

